Skip to content

fix: Require at least one alphanumeric char in workspace name#9263

Merged
sriramveeraghanta merged 1 commit into
makeplane:previewfrom
okxint:fix/workspace-name-alphanumeric-required-2
Jun 20, 2026
Merged

fix: Require at least one alphanumeric char in workspace name#9263
sriramveeraghanta merged 1 commit into
makeplane:previewfrom
okxint:fix/workspace-name-alphanumeric-required-2

Conversation

@okxint

@okxint okxint commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

COMPANY_NAME_REGEX only blocks disallowed characters — it never checks that the name actually contains a letter or digit. So names like -_________- or --- pass validation cleanly.

Added a second check using \p{L}\p{N} (Unicode-aware) in both validateCompanyName and validateWorkspaceName. International names (Japanese, Arabic, accented chars) still pass fine since \p{L} covers all Unicode letters.

Closes #9255

Summary by CodeRabbit

  • Bug Fixes
    • Enhanced validation for company and workspace names to require at least one letter or number in addition to existing allowlist rules.

`COMPANY_NAME_REGEX` blocks disallowed chars but accepts symbol-only
strings like `-_________-` since `-` and `_` are in the allowed set.
Add `HAS_ALPHANUMERIC_REGEX` and check it in `validateWorkspaceName`
and `validateCompanyName` so inputs with no letter or digit are rejected.

Fixes makeplane#9255

Signed-off-by: okxint <cashmein.eth@gmail.com>
@coderabbitai

coderabbitai Bot commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 1104d283-3244-4768-820c-014605b144e1

📥 Commits

Reviewing files that changed from the base of the PR and between 53a323d and 6deb3c6.

📒 Files selected for processing (1)
  • packages/utils/src/validation.ts

📝 Walkthrough

Walkthrough

Adds a new exported regex constant HAS_ALPHANUMERIC_REGEX that matches at least one Unicode letter or digit. Both validateCompanyName and validateWorkspaceName are updated to apply this regex as an additional post-allowlist check, returning an error when the input contains no letters or numbers.

Changes

Alphanumeric validation for company and workspace names

Layer / File(s) Summary
HAS_ALPHANUMERIC_REGEX definition and validator updates
packages/utils/src/validation.ts
Defines HAS_ALPHANUMERIC_REGEX (/\p{L}|\p{N}/u) with inline documentation, then applies it in validateCompanyName and validateWorkspaceName after existing injection-risk and allowlist checks, returning a "must contain at least one letter or number" error for symbol-only inputs.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐇 A name made of dashes? Not on my watch!
The rabbit demands at least one letter or notch.
No -_________- shall slip through the gate,
A letter or digit must show up — don't be late!
Hop hop, the regex is set, the symbols retreat. ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description provides clear context about the validation gap and the solution using Unicode-aware regex, but lacks the structured template sections for Type of Change, Test Scenarios, and other required template elements. Add missing template sections: specify Type of Change (Bug fix), describe Test Scenarios, and follow the full description template structure for consistency.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title directly relates to the main change: requiring at least one alphanumeric character in workspace names, which is the primary objective addressed.
Linked Issues check ✅ Passed The changes fully address issue #9255 by adding Unicode-aware alphanumeric validation to both validateCompanyName and validateWorkspaceName functions, preventing symbol-only workspace names.
Out of Scope Changes check ✅ Passed All changes are focused on adding the HAS_ALPHANUMERIC_REGEX validation check to the two validation functions, directly addressing the linked issue objective with no out-of-scope modifications.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@sriramveeraghanta sriramveeraghanta merged commit 0f1f4d5 into makeplane:preview Jun 20, 2026
11 checks passed
sriramveeraghanta added a commit that referenced this pull request Jun 20, 2026
…9278)

* fix(api): require at least one alphanumeric char in workspace name

Workspace name validation was enforced only on the frontend
(validateWorkspaceName), which gates the UI submit but is bypassable
via a direct API call. The backend WorkSpaceSerializer.validate_name
only rejected URLs, so a symbol-only name like "-_________-" could
still be saved via create or the rename (partial_update) path.

Add a Unicode-aware has_alphanumeric() helper and enforce it in both
the app and instance/license workspace serializers, mirroring the
frontend HAS_ALPHANUMERIC_REGEX (/[\p{L}\p{N}]/u) added in #9263.
International names (日本語, José, محمد) still pass since str.isalnum()
covers all scripts.

Adds unit tests covering symbol-only rejection and international
acceptance on both serializers.

Refs #9255

Signed-off-by: sriramveeraghanta <veeraghanta.sriram@gmail.com>

* fix(api): reject URLs in instance workspace name for parity

Address CodeRabbit review on #9278: the instance/license
WorkspaceSerializer.validate_name rejected symbol-only names but, unlike
the app-level WorkSpaceSerializer, still accepted names containing URLs.
Add the same contains_url() guard (imported from plane.utils.url, not
content_validator) so both workspace-create paths validate identically.

Add unit tests asserting URL-containing names are rejected on both
serializers.

Signed-off-by: sriramveeraghanta <veeraghanta.sriram@gmail.com>

---------

Signed-off-by: sriramveeraghanta <veeraghanta.sriram@gmail.com>
gentslava added a commit to gentslava/plane that referenced this pull request Jun 20, 2026
…cope + workspace-name валидация + Storybook v10)

upstream makeplane#9269/makeplane#9270 (scope issue-ID/cascade-delete к workspace в bulk-эндпоинтах), makeplane#9263/makeplane#9278 (workspace name ≥1 буквенно-цифровой), makeplane#9277 (Storybook v10). Конфликт sub_issue.py разрешён объединением: eyriehq validate_sub_issues_bulk + upstream workspace__slug-scope. Наш GraphQL-шлюз уже безопасен (мутации ре-парента scope по project=p), поддержка не нужна.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[bug]: [bug]: Workspace name field accepts symbol-only input (e.g. "-_________-") despite active character validation

2 participants